//
//  AEGoodsDetailBottomView.m
//  AESOLAR_IOS
//
//  Created by Bin Tang on 2024/10/14.
//  Copyright © 2024 Mr.Wang. All rights reserved.
//

#import "AEGoodsDetailBottomView.h"
#import "AE_Solar-Swift.h"

@interface AEGoodsDetailBottomView ()

/// 立即兑换
@property (nonatomic, strong) UIButton *btnExchange;
@end

@implementation AEGoodsDetailBottomView

- (void)initWithSubView {
    [super initWithSubView];
    self.backgroundColor = kWhiteColor;
    
    [self initWithBtnExchange];
}

- (void)initWithBtnExchange {
    if (!_btnExchange) {
        NSString *title = [AEStringExten localizedValueWithKey:@"立即兑换"];
        CGRect frame = CGRectMake(24, 10.5, self.width - 24 * 2, 44);
        _btnExchange = [UIButton createWithButton:self frame:frame font:[UIFont systemFontOfSize:18 weight:UIFontWeightBold] target:self action:@selector(actionWithImmediateExchange:) propertiesBlock:^(UIButton * _Nonnull button) {
            [button setTitle:title forState:UIControlStateNormal];
            [button setTitleColor:kWhiteColor forState:UIControlStateNormal];
            button.backgroundColor = [UIColor colorWithHexString:@"#F6020A"];
            button.layer.cornerRadius = frame.size.height * 0.5;
            button.layer.masksToBounds = YES;
        }];
    }
}

/// 立即兑换
/// - Parameter sender: sender description
- (void)actionWithImmediateExchange:(id)sender {
    if (self.touchImmediateExchangeBlock) {
        self.touchImmediateExchangeBlock();
    }
}

@end
